Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
For type-checking Javascript values.
Example
const t = require('typical')
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
Returns true if input is a number
Kind: static method of typical
Param | Type | Description |
---|---|---|
n | * | the input to test |
Example
> t.isNumber(0)
true
> t.isNumber(1)
true
> t.isNumber(1.1)
true
> t.isNumber(0xff)
true
> t.isNumber(0644)
true
> t.isNumber(6.2e5)
true
> t.isNumber(NaN)
false
> t.isNumber(Infinity)
false
boolean
A plain object is a simple object literal, it is not an instance of a class. Returns true if the input typeof
is object
and directly decends from Object
.
Kind: static method of typical
Param | Type | Description |
---|---|---|
input | * | the input to test |
Example
> t.isPlainObject({ clive: 'hater' })
true
> t.isPlainObject(new Date())
false
> t.isPlainObject([ 0, 1 ])
false
> t.isPlainObject(1)
false
> t.isPlainObject(/test/)
false
boolean
An array-like value has all the properties of an array, but is not an array instance. Examples in the arguments
object. Returns true if the input value is an object, not null and has a length
property with a numeric value.
Kind: static method of typical
Param | Type | Description |
---|---|---|
input | * | the input to test |
Example
function sum(x, y){
console.log(t.isArrayLike(arguments))
// prints `true`
}
boolean
returns true if the typeof input is 'object'
, but not null!
Kind: static method of typical
Param | Type | Description |
---|---|---|
input | * | the input to test |
boolean
Returns true if the input value is defined
Kind: static method of typical
Param | Type | Description |
---|---|---|
input | * | the input to test |
boolean
Returns true if the input value is a string
Kind: static method of typical
Param | Type | Description |
---|---|---|
input | * | the input to test |
boolean
Returns true if the input value is a boolean
Kind: static method of typical
Param | Type | Description |
---|---|---|
input | * | the input to test |
boolean
Returns true if the input value is a function
Kind: static method of typical
Param | Type | Description |
---|---|---|
input | * | the input to test |
boolean
Returns true if the input value is an es2015 class
.
Kind: static method of typical
Param | Type | Description |
---|---|---|
input | * | the input to test |
boolean
Returns true if the input is a string, number, symbol, boolean, null or undefined value.
Kind: static method of typical
Param | Type | Description |
---|---|---|
input | * | the input to test |
boolean
Returns true if the input is a Promise.
Kind: static method of typical
Param | Type | Description |
---|---|---|
input | * | the input to test |
boolean
Returns true if the input is an iterable (Map
, Set
, Array
etc.).
Kind: static method of typical
Param | Type | Description |
---|---|---|
input | * | the input to test |
© 2014-17 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.
FAQs
Isomorphic, functional type-checking for Javascript
The npm package typical receives a total of 3,655,661 weekly downloads. As such, typical popularity was classified as popular.
We found that typical demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.